package com.itheima.socket.udp.demo02;

import java.io.IOException;
import java.net.*;
import java.util.Scanner;

public class SendDemo02 {

    public static void main(String[] args) throws IOException {

//        DatagramSocket datagramSocket = new DatagramSocket();
        while (true) {
            DatagramSocket datagramSocket = new DatagramSocket();

            Scanner scanner = new Scanner(System.in);
            String next = scanner.next();

            byte[] bytes = next.getBytes();
            int length = bytes.length;
            InetAddress inetAddress = InetAddress.getByName("192.168.19.34");
            int port = 7777;

            DatagramPacket datagramPacket = new DatagramPacket(bytes, length, inetAddress, port);

            datagramSocket.send(datagramPacket);
            datagramSocket.close();

        }

    }

}
